package com.superpai.api;

import com.superpai.common.Constants;
import com.superpai.request.deal.SellerSearchDealListRequest;
import com.superpai.response.deal.SellerSearchDealListResponse;
import com.superpai.utils.DefaultClient;

/**
 * @author Devin.Hu
 * @date 2011-9-24
 * @version V1.0
 * @description 订单api
 */
public class DealAPI extends BaseAPI{

	
	/**
	 * 卖家查找订单列表信息
	 * 
	 * @param selleruin 	卖家QQ号
	 * @param dealState 	订单状态
	 * @param itemCode		商品编码
	 * @param dealCode 		订单编码 
	 * @param pageIndex		页数索引
	 * @return
	 * @throws Exception
	 */
	public SellerSearchDealListResponse sellerSearchDealList(int selleruin, String dealState, String itemCode, String dealCode,int pageIndex) throws Exception{
		return sellerSearchDealList(selleruin, dealState, itemCode, dealCode, 0, pageIndex, 20);
	}
	
	/**
	 * 卖家查找订单列表信息
	 * 
	 * @param sellerUin 	卖家QQ号
	 * @param dealState 	订单状态
	 * @param itemCode		商品编码
	 * @param dealCode 		订单编码 
	 * @param orderDesc 	是否逆序排列
	 * @param pageIndex		页数索引
	 * @param pageSize		页大小 
	 * @return
	 * @throws Exception
	 */
	public SellerSearchDealListResponse sellerSearchDealList(int sellerUin, String dealState, String itemCode, String dealCode,int orderDesc,int pageIndex,int pageSize) throws Exception{
		SellerSearchDealListRequest req = new SellerSearchDealListRequest();
		req.setSellerUin(sellerUin);
		req.setDealState(dealState);
		req.setItemCode(itemCode);
		req.setOrderDesc(orderDesc);
		req.setPageIndex(pageIndex);
		req.setPageSize(pageSize);
		
		DefaultClient client = new DefaultClient(Constants.deal_sellerSearchDealList, true);
		SellerSearchDealListResponse response  = client.execute(req);
		return response;
	}
}
